<?php
/**
 * Created by litong on Date: 2018/12/24 0024 上午 10:43
 */
interface iTemplate{
  public function setVariables($name,$value);
  public function getHtml($template);
}
class Template implements iTemplate{
  private $var=array();

  public function setVariables($name, $value)
  {
    $this->vars[$name]=$value;
  }

  public function getHtml($template)
  {
    foreach($this->var as $name=>$value){
      $template=str_replace('{'.$name.'}',$value,$template);
    }
    return $template;
  }
}
?>